feat(rich-markdown-editor): live media embeds + shared embed detection util#5290
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Shared util — Rich markdown editor — Optional Knowledge chunk editor — Layout only: centered Tests cover Reviewed by Cursor Bugbot for commit 427f8d4. Configure here. |
Greptile SummaryThis PR adds shared media embed detection and live embeds for the rich markdown editor. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "refactor(media-embed): tighten comments ..." | Re-trigger Greptile |
…n util - Extract getEmbedInfo/EmbedInfo into pure @sim/utils/media-embed (carries the PR #5288 dropbox host-validation hardening); repoint the note block to it - Add LinkEmbed: a ProseMirror widget-decoration plugin that renders media players (YouTube, Vimeo, Spotify, Dropbox, …) beneath standalone links in the rich markdown editor, in both editing and read-only surfaces. The document stays a plain markdown link, so markdown round-trips stay lossless - Gate embeds behind an opt-in flag (on for the file editor, off for modal fields) - Polish the knowledge chunk editor to the file editor's centered reading frame while keeping it plaintext for exact embedding fidelity
30d0ddb to
647c498
Compare
Validate each platform against the URL's parsed host before extracting, so a look-alike host (youtube.com.evil.com) or a provider domain in the path (evil.com/youtube.com/...) can no longer render a trusted-looking embed. Dropbox is no longer a special case — all providers share the hostMatches gate. Also consolidates the five Spotify branches and orders Twitch clip before channel.
|
@cursor review |
Key embed widgets by source + per-source occurrence index so two standalone links to the same URL render as two distinct players instead of collapsing into one, while keeping the key stable across unrelated edits (no iframe reload).
- Drop the redundant paragraph type-check in getStandaloneLinkHref (the caller already filters to paragraphs) and rename the param for clarity - Remove an inline comment and a TSDoc sentence that restated logic documented elsewhere
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 427f8d4. Configure here.
Summary
getEmbedInfo/EmbedInfointo a pure@sim/utils/media-embedmodule (string →{url, type, aspectRatio}); the workflow note block now imports it instead of carrying its own ~270-line copyLinkEmbedProseMirror widget-decoration plugin renders players (YouTube, Vimeo, Spotify, Dropbox, …) beneath a standalone link, in both editing and read-only surfaces (Linear/Notion-style auto-embed via StarterKit autolink)embedsflag — on for the file editor, off for the compact modal fieldsmax-w-[48rem]), kept plaintext to preserve exact text fidelity for embeddings (tokenizer overlay + token count intact)Type of Change
Testing
media-embed.test.ts(7) — platform detection + Dropbox host-validation security caseslink-embed.test.ts(5) — renders for standalone embeddable links, lossless markdown round-trip, no embed for inline/non-embeddable links, off when disabledapps/simtsc 0 errors · both packages typecheck · monorepo boundary + realtime prune checks passNote
This carries forward the Dropbox host-validation hardening from #5288 into the shared util. Since this branch removes the inline
getEmbedInfofromnote-block-view.tsx(which #5288 patches), the two will conflict — recommend merging #5288 first, then this rebases to "inline removed, fix lives in the util."Checklist